package com.zdp.rabbitmq.config;



import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author sesshomaru
 * @date 2019/11/25 10:43
 */
@Configuration
@ComponentScan(basePackages = "com.zdp.*")
public class RabbitConfig {

    @Bean
    public TopicExchange exchange001(){
        return new TopicExchange("exchange001",false,false);
    }

    @Bean
    public Queue queue001(){
        return new Queue("queue001",true,false,false);
    }

    @Bean
    public Binding binding001() {
        return BindingBuilder.bind(queue001()).to(exchange001()).with("springboot.#");
    }
}
